<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>class Racc::LogFileGenerator - racc: Ruby Standard Library Documentation</title>


<script src="../js/navigation.js" defer></script>
<script src="../js/search.js" defer></script>
<script src="../js/search_index.js" defer></script>
<script src="../js/searcher.js" defer></script>
<script src="../js/darkfish.js" defer></script>

<script src="../js/jquery-3.2.0.min.js"></script>

<script src="../js/vue.min.js"></script>
<script src="../js/js.cookie.min.js"></script>

<link href="../css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="../css/rdoc.css" rel="stylesheet">
<link href="../css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../";
  var index_rel_prefix = "../";
  var darkModeCsseHref = "../css/rdoc-dm.css"
  var defaultModeCssHref = "../css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="class">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="../index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="../table_of_contents.html#pages">Pages</a>
    <a href="../table_of_contents.html#classes">Classes</a>
    <a href="../table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link"><a href="../Object.html">Object</a>
</div>

        
        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-c-new">::new</a>
    <li ><a href="#method-i-action_out">#action_out</a>
    <li ><a href="#method-i-outact">#outact</a>
    <li ><a href="#method-i-output">#output</a>
    <li ><a href="#method-i-output_conflict">#output_conflict</a>
    <li ><a href="#method-i-output_rule">#output_rule</a>
    <li ><a href="#method-i-output_state">#output_state</a>
    <li ><a href="#method-i-output_token">#output_token</a>
    <li ><a href="#method-i-output_useless">#output_useless</a>
    <li ><a href="#method-i-outrrconf">#outrrconf</a>
    <li ><a href="#method-i-outsrconf">#outsrconf</a>
    <li ><a href="#method-i-pointer_out">#pointer_out</a>
    <li ><a href="#method-i-symbol_locations">#symbol_locations</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="class-Racc::LogFileGenerator">
    <h1 id="class-Racc::LogFileGenerator" class="class">
      class Racc::LogFileGenerator
    </h1>

    <section class="description">
    
    </section>

      <section id="5Buntitled-5D" class="documentation-section">





                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-new" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">new</span><span
                                class="method-args">(states, debug_flags = DebugFlags.new)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="new-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/logfilegenerator.rb, line 17</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">states</span>, <span class="ruby-identifier">debug_flags</span> = <span class="ruby-constant">DebugFlags</span>.<span class="ruby-identifier">new</span>)
  <span class="ruby-ivar">@states</span> = <span class="ruby-identifier">states</span>
  <span class="ruby-ivar">@grammar</span> = <span class="ruby-identifier">states</span>.<span class="ruby-identifier">grammar</span>
  <span class="ruby-ivar">@debug_flags</span> = <span class="ruby-identifier">debug_flags</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-action_out" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">action_out</span><span
                                class="method-args">(f, state)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="action_out-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/logfilegenerator.rb, line 92</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">action_out</span>(<span class="ruby-identifier">f</span>, <span class="ruby-identifier">state</span>)
  <span class="ruby-identifier">sr</span> = <span class="ruby-identifier">state</span>.<span class="ruby-identifier">srconf</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">state</span>.<span class="ruby-identifier">srconf</span>.<span class="ruby-identifier">dup</span>
  <span class="ruby-identifier">rr</span> = <span class="ruby-identifier">state</span>.<span class="ruby-identifier">rrconf</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">state</span>.<span class="ruby-identifier">rrconf</span>.<span class="ruby-identifier">dup</span>
  <span class="ruby-identifier">acts</span> = <span class="ruby-identifier">state</span>.<span class="ruby-identifier">action</span>
  <span class="ruby-identifier">keys</span> = <span class="ruby-identifier">acts</span>.<span class="ruby-identifier">keys</span>
  <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">sort!</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">a</span>,<span class="ruby-identifier">b</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">ident</span> <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-identifier">b</span>.<span class="ruby-identifier">ident</span> }

  [ <span class="ruby-constant">Shift</span>, <span class="ruby-constant">Reduce</span>, <span class="ruby-constant">Error</span>, <span class="ruby-constant">Accept</span> ].<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">klass</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">delete_if</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">tok</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">act</span> = <span class="ruby-identifier">acts</span>[<span class="ruby-identifier">tok</span>]
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">act</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-identifier">klass</span>)
        <span class="ruby-identifier">outact</span> <span class="ruby-identifier">f</span>, <span class="ruby-identifier">tok</span>, <span class="ruby-identifier">act</span>
        <span class="ruby-keyword">if</span> <span class="ruby-identifier">sr</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">c</span> = <span class="ruby-identifier">sr</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">tok</span>)
          <span class="ruby-identifier">outsrconf</span> <span class="ruby-identifier">f</span>, <span class="ruby-identifier">c</span>
        <span class="ruby-keyword">end</span>
        <span class="ruby-keyword">if</span> <span class="ruby-identifier">rr</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">c</span> = <span class="ruby-identifier">rr</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">tok</span>)
          <span class="ruby-identifier">outrrconf</span> <span class="ruby-identifier">f</span>, <span class="ruby-identifier">c</span>
        <span class="ruby-keyword">end</span>

        <span class="ruby-keyword">true</span>
      <span class="ruby-keyword">else</span>
        <span class="ruby-keyword">false</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">sr</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">tok</span>, <span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-identifier">outsrconf</span> <span class="ruby-identifier">f</span>, <span class="ruby-identifier">c</span> } <span class="ruby-keyword">if</span> <span class="ruby-identifier">sr</span>
  <span class="ruby-identifier">rr</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">tok</span>, <span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-identifier">outrrconf</span> <span class="ruby-identifier">f</span>, <span class="ruby-identifier">c</span> } <span class="ruby-keyword">if</span> <span class="ruby-identifier">rr</span>

  <span class="ruby-identifier">act</span> = <span class="ruby-identifier">state</span>.<span class="ruby-identifier">defact</span>
  <span class="ruby-keyword">if</span> <span class="ruby-keyword">not</span> <span class="ruby-identifier">act</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Error</span>) <span class="ruby-keyword">or</span> <span class="ruby-ivar">@debug_flags</span>.<span class="ruby-identifier">any?</span>
    <span class="ruby-identifier">outact</span> <span class="ruby-identifier">f</span>, <span class="ruby-string">&#39;$default&#39;</span>, <span class="ruby-identifier">act</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">f</span>.<span class="ruby-identifier">puts</span>
  <span class="ruby-identifier">state</span>.<span class="ruby-identifier">goto_table</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">t</span>, <span class="ruby-identifier">st</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">nonterminal?</span>
      <span class="ruby-identifier">f</span>.<span class="ruby-identifier">printf</span> <span class="ruby-string">&quot;  %-12s  go to state %d\n&quot;</span>, <span class="ruby-identifier">t</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">st</span>.<span class="ruby-identifier">ident</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-outact" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">outact</span><span
                                class="method-args">(f, t, act)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="outact-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/logfilegenerator.rb, line 133</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">outact</span>(<span class="ruby-identifier">f</span>, <span class="ruby-identifier">t</span>, <span class="ruby-identifier">act</span>)
  <span class="ruby-keyword">case</span> <span class="ruby-identifier">act</span>
  <span class="ruby-keyword">when</span> <span class="ruby-constant">Shift</span>
    <span class="ruby-identifier">f</span>.<span class="ruby-identifier">printf</span> <span class="ruby-string">&quot;  %-12s  shift, and go to state %d\n&quot;</span>,
             <span class="ruby-identifier">t</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">act</span>.<span class="ruby-identifier">goto_id</span>
  <span class="ruby-keyword">when</span> <span class="ruby-constant">Reduce</span>
    <span class="ruby-identifier">f</span>.<span class="ruby-identifier">printf</span> <span class="ruby-string">&quot;  %-12s  reduce using rule %d (%s)\n&quot;</span>,
             <span class="ruby-identifier">t</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">act</span>.<span class="ruby-identifier">ruleid</span>, <span class="ruby-identifier">act</span>.<span class="ruby-identifier">rule</span>.<span class="ruby-identifier">target</span>.<span class="ruby-identifier">to_s</span>
  <span class="ruby-keyword">when</span> <span class="ruby-constant">Accept</span>
    <span class="ruby-identifier">f</span>.<span class="ruby-identifier">printf</span> <span class="ruby-string">&quot;  %-12s  accept\n&quot;</span>, <span class="ruby-identifier">t</span>.<span class="ruby-identifier">to_s</span>
  <span class="ruby-keyword">when</span> <span class="ruby-constant">Error</span>
    <span class="ruby-identifier">f</span>.<span class="ruby-identifier">printf</span> <span class="ruby-string">&quot;  %-12s  error\n&quot;</span>, <span class="ruby-identifier">t</span>.<span class="ruby-identifier">to_s</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;racc: fatal: wrong act for outact: act=#{act}(#{act.class})&quot;</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-output" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">output</span><span
                                class="method-args">(out)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="output-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/logfilegenerator.rb, line 23</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">output</span>(<span class="ruby-identifier">out</span>)
  <span class="ruby-identifier">output_conflict</span> <span class="ruby-identifier">out</span>; <span class="ruby-identifier">out</span>.<span class="ruby-identifier">puts</span>
  <span class="ruby-identifier">output_useless</span>  <span class="ruby-identifier">out</span>; <span class="ruby-identifier">out</span>.<span class="ruby-identifier">puts</span>
  <span class="ruby-identifier">output_rule</span>     <span class="ruby-identifier">out</span>; <span class="ruby-identifier">out</span>.<span class="ruby-identifier">puts</span>
  <span class="ruby-identifier">output_token</span>    <span class="ruby-identifier">out</span>; <span class="ruby-identifier">out</span>.<span class="ruby-identifier">puts</span>
  <span class="ruby-identifier">output_state</span>    <span class="ruby-identifier">out</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-output_conflict" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">output_conflict</span><span
                                class="method-args">(out)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Warnings</p>

                              <div class="method-source-code" id="output_conflict-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/logfilegenerator.rb, line 35</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">output_conflict</span>(<span class="ruby-identifier">out</span>)
  <span class="ruby-ivar">@states</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">state</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">state</span>.<span class="ruby-identifier">srconf</span>
      <span class="ruby-identifier">out</span>.<span class="ruby-identifier">printf</span> <span class="ruby-string">&quot;state %d contains %d shift/reduce conflicts\n&quot;</span>,
                 <span class="ruby-identifier">state</span>.<span class="ruby-identifier">stateid</span>, <span class="ruby-identifier">state</span>.<span class="ruby-identifier">srconf</span>.<span class="ruby-identifier">size</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">state</span>.<span class="ruby-identifier">rrconf</span>
      <span class="ruby-identifier">out</span>.<span class="ruby-identifier">printf</span> <span class="ruby-string">&quot;state %d contains %d reduce/reduce conflicts\n&quot;</span>,
                 <span class="ruby-identifier">state</span>.<span class="ruby-identifier">stateid</span>, <span class="ruby-identifier">state</span>.<span class="ruby-identifier">rrconf</span>.<span class="ruby-identifier">size</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-output_rule" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">output_rule</span><span
                                class="method-args">(out)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Rules</p>

                              <div class="method-source-code" id="output_rule-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/logfilegenerator.rb, line 170</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">output_rule</span>(<span class="ruby-identifier">out</span>)
  <span class="ruby-identifier">out</span>.<span class="ruby-identifier">print</span> <span class="ruby-string">&quot;-------- Grammar --------\n\n&quot;</span>
  <span class="ruby-ivar">@grammar</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">rl</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">if</span> <span class="ruby-ivar">@debug_flags</span>.<span class="ruby-identifier">any?</span> <span class="ruby-keyword">or</span> <span class="ruby-identifier">rl</span>.<span class="ruby-identifier">ident</span> <span class="ruby-operator">!=</span> <span class="ruby-value">0</span>
      <span class="ruby-identifier">out</span>.<span class="ruby-identifier">printf</span> <span class="ruby-string">&quot;rule %d %s: %s\n&quot;</span>,
                 <span class="ruby-identifier">rl</span>.<span class="ruby-identifier">ident</span>, <span class="ruby-identifier">rl</span>.<span class="ruby-identifier">target</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">rl</span>.<span class="ruby-identifier">symbols</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&#39; &#39;</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-output_state" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">output_state</span><span
                                class="method-args">(out)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p><a href="States.html"><code>States</code></a></p>

                              <div class="method-source-code" id="output_state-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/logfilegenerator.rb, line 66</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">output_state</span>(<span class="ruby-identifier">out</span>)
  <span class="ruby-identifier">out</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;--------- State ---------\n&quot;</span>

  <span class="ruby-identifier">showall</span> = <span class="ruby-ivar">@debug_flags</span>.<span class="ruby-identifier">la</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@debug_flags</span>.<span class="ruby-identifier">state</span>
  <span class="ruby-ivar">@states</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">state</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">out</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;\nstate #{state.ident}\n\n&quot;</span>

    (<span class="ruby-identifier">showall</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">state</span>.<span class="ruby-identifier">closure</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">state</span>.<span class="ruby-identifier">core</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ptr</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">pointer_out</span>(<span class="ruby-identifier">out</span>, <span class="ruby-identifier">ptr</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">ptr</span>.<span class="ruby-identifier">rule</span>.<span class="ruby-identifier">ident</span> <span class="ruby-operator">!=</span> <span class="ruby-value">0</span> <span class="ruby-keyword">or</span> <span class="ruby-identifier">showall</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">out</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;\n&quot;</span>

    <span class="ruby-identifier">action_out</span> <span class="ruby-identifier">out</span>, <span class="ruby-identifier">state</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-output_token" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">output_token</span><span
                                class="method-args">(out)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Tokens</p>

                              <div class="method-source-code" id="output_token-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/logfilegenerator.rb, line 184</span>
    <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">output_token</span>(<span class="ruby-identifier">out</span>)
      <span class="ruby-identifier">out</span>.<span class="ruby-identifier">print</span> <span class="ruby-string">&quot;------- Symbols -------\n\n&quot;</span>

      <span class="ruby-identifier">out</span>.<span class="ruby-identifier">print</span> <span class="ruby-string">&quot;**Nonterminals, with rules where they appear\n\n&quot;</span>
      <span class="ruby-ivar">@grammar</span>.<span class="ruby-identifier">each_nonterminal</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span>
        <span class="ruby-identifier">tmp</span> = <span class="ruby-identifier">&lt;&lt;SRC</span>
<span class="ruby-value">  %s (%d)
    on right: %s
    on left : %s
</span><span class="ruby-identifier">SRC</span>
        <span class="ruby-identifier">out</span>.<span class="ruby-identifier">printf</span> <span class="ruby-identifier">tmp</span>, <span class="ruby-identifier">t</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">t</span>.<span class="ruby-identifier">ident</span>,
                   <span class="ruby-identifier">symbol_locations</span>(<span class="ruby-identifier">t</span>.<span class="ruby-identifier">locate</span>).<span class="ruby-identifier">join</span>(<span class="ruby-string">&#39; &#39;</span>),
                   <span class="ruby-identifier">symbol_locations</span>(<span class="ruby-identifier">t</span>.<span class="ruby-identifier">heads</span>).<span class="ruby-identifier">join</span>(<span class="ruby-string">&#39; &#39;</span>)
      <span class="ruby-keyword">end</span>

      <span class="ruby-identifier">out</span>.<span class="ruby-identifier">print</span> <span class="ruby-string">&quot;\n**Terminals, with rules where they appear\n\n&quot;</span>
      <span class="ruby-ivar">@grammar</span>.<span class="ruby-identifier">each_terminal</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span>
        <span class="ruby-identifier">out</span>.<span class="ruby-identifier">printf</span> <span class="ruby-string">&quot;  %s (%d) %s\n&quot;</span>,
                   <span class="ruby-identifier">t</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">t</span>.<span class="ruby-identifier">ident</span>, <span class="ruby-identifier">symbol_locations</span>(<span class="ruby-identifier">t</span>.<span class="ruby-identifier">locate</span>).<span class="ruby-identifier">join</span>(<span class="ruby-string">&#39; &#39;</span>)
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-output_useless" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">output_useless</span><span
                                class="method-args">(out)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="output_useless-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/logfilegenerator.rb, line 48</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">output_useless</span>(<span class="ruby-identifier">out</span>)
  <span class="ruby-ivar">@grammar</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">rl</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">rl</span>.<span class="ruby-identifier">useless?</span>
      <span class="ruby-identifier">out</span>.<span class="ruby-identifier">printf</span> <span class="ruby-string">&quot;rule %d (%s) never reduced\n&quot;</span>,
                 <span class="ruby-identifier">rl</span>.<span class="ruby-identifier">ident</span>, <span class="ruby-identifier">rl</span>.<span class="ruby-identifier">target</span>.<span class="ruby-identifier">to_s</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-ivar">@grammar</span>.<span class="ruby-identifier">each_nonterminal</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">useless?</span>
      <span class="ruby-identifier">out</span>.<span class="ruby-identifier">printf</span> <span class="ruby-string">&quot;useless nonterminal %s\n&quot;</span>, <span class="ruby-identifier">t</span>.<span class="ruby-identifier">to_s</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-outrrconf" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">outrrconf</span><span
                                class="method-args">(f, confs)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="outrrconf-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/logfilegenerator.rb, line 158</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">outrrconf</span>(<span class="ruby-identifier">f</span>, <span class="ruby-identifier">confs</span>)
  <span class="ruby-identifier">confs</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">r</span> = <span class="ruby-identifier">c</span>.<span class="ruby-identifier">low_prec</span>
    <span class="ruby-identifier">f</span>.<span class="ruby-identifier">printf</span> <span class="ruby-string">&quot;  %-12s  [reduce using rule %d (%s)]\n&quot;</span>,
             <span class="ruby-identifier">c</span>.<span class="ruby-identifier">token</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">r</span>.<span class="ruby-identifier">ident</span>, <span class="ruby-identifier">r</span>.<span class="ruby-identifier">target</span>.<span class="ruby-identifier">to_s</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-outsrconf" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">outsrconf</span><span
                                class="method-args">(f, confs)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="outsrconf-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/logfilegenerator.rb, line 150</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">outsrconf</span>(<span class="ruby-identifier">f</span>, <span class="ruby-identifier">confs</span>)
  <span class="ruby-identifier">confs</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">r</span> = <span class="ruby-identifier">c</span>.<span class="ruby-identifier">reduce</span>
    <span class="ruby-identifier">f</span>.<span class="ruby-identifier">printf</span> <span class="ruby-string">&quot;  %-12s  [reduce using rule %d (%s)]\n&quot;</span>,
             <span class="ruby-identifier">c</span>.<span class="ruby-identifier">shift</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">r</span>.<span class="ruby-identifier">ident</span>, <span class="ruby-identifier">r</span>.<span class="ruby-identifier">target</span>.<span class="ruby-identifier">to_s</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-pointer_out" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">pointer_out</span><span
                                class="method-args">(out, ptr)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="pointer_out-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/logfilegenerator.rb, line 82</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">pointer_out</span>(<span class="ruby-identifier">out</span>, <span class="ruby-identifier">ptr</span>)
  <span class="ruby-identifier">buf</span> = <span class="ruby-identifier">sprintf</span>(<span class="ruby-string">&quot;%4d) %s :&quot;</span>, <span class="ruby-identifier">ptr</span>.<span class="ruby-identifier">rule</span>.<span class="ruby-identifier">ident</span>, <span class="ruby-identifier">ptr</span>.<span class="ruby-identifier">rule</span>.<span class="ruby-identifier">target</span>.<span class="ruby-identifier">to_s</span>)
  <span class="ruby-identifier">ptr</span>.<span class="ruby-identifier">rule</span>.<span class="ruby-identifier">symbols</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">tok</span>, <span class="ruby-identifier">idx</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">buf</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&#39; _&#39;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">idx</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">ptr</span>.<span class="ruby-identifier">index</span>
    <span class="ruby-identifier">buf</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&#39; &#39;</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">tok</span>.<span class="ruby-identifier">to_s</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">buf</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&#39; _&#39;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">ptr</span>.<span class="ruby-identifier">reduce?</span>
  <span class="ruby-identifier">out</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">buf</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-symbol_locations" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">symbol_locations</span><span
                                class="method-args">(locs)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="symbol_locations-source">
            <pre><span class="ruby-comment"># File racc-1.7.1/lib/racc/logfilegenerator.rb, line 206</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">symbol_locations</span>(<span class="ruby-identifier">locs</span>)
  <span class="ruby-identifier">locs</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">loc</span><span class="ruby-operator">|</span> <span class="ruby-identifier">loc</span>.<span class="ruby-identifier">rule</span>.<span class="ruby-identifier">ident</span> }.<span class="ruby-identifier">reject</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">n</span><span class="ruby-operator">|</span> <span class="ruby-identifier">n</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> }.<span class="ruby-identifier">uniq</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is provided by <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>. </p><p><a href="https://jamesbritt.bandcamp.com/">Hack your world.  Feed your head.  Live curious</a>.</p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

